<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js</title>
</head>
<body>
<input type="button" value="点击弹窗" onclick="show1()">
<script>
    function show1() {
        alert("点我干嘛");
    }
</script>

<input type="button" value="点击弹窗2" onclick="show2()" id="btn2">
<script>
    document.getElementById("btn2").onclick = function () {
        alert("点我干嘛");
    }
</script>


</body>
</html>